package com.zhz.livegoods.mapper.impl;

import com.zhz.livegoods.pojo.Banner;
import com.zhz.livegoods.mapper.BannerMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Banner数据访问对象
 * 连接MongoDB，访问banner集合。实现数据的查询。
 * @author zhz
 * @date 2020/08/03
 **/
@Repository
public class BannerMapperImpl implements BannerMapper {
    @Autowired
    private MongoTemplate mongoTemplate;
    @Override
    public List<Banner> selectBanners(Query query) {
        return mongoTemplate.find(query,Banner.class);
    }
}
